<script setup>
import { toRefs, computed } from 'vue';
import { ElEmpty } from 'element-plus';

const props = defineProps({
  attributeTable: Array,
});
const { attributeTable } = toRefs(props);

const rowCount = computed(() => {
  return Math.ceil(attributeTable?.value?.length / 1);
});
</script>
<template>
  <div class="root_questionnaire">
    <ElEmpty v-if="!attributeTable?.length" description="暂无属性信息" />
    <table class="mailTable">
      <tr v-for="index in rowCount" :key="index">
        <td class="column">{{ attributeTable[index - 1].key }}</td>
        <td>{{ attributeTable[index - 1].value }}</td>
      </tr>
    </table>
  </div>
</template>

<style scoped lang="scss">
.root_questionnaire {
  margin: 16px;
  :deep(.el-empty) {
    position: relative;
    top: 32px;
  }

  .mailTable,
  .mailTable tr,
  .mailTable tr td {
    border: 1px solid #c1c1c1;
  }
  .mailTable {
    width: 448px;
    color: #ffffff;
    font-size: 12px;
    text-align: left;
    border-collapse: collapse;
  }
  .mailTable tr td {
    box-sizing: border-box;
    width: 336px;
    height: 35px;
    padding: 0 20px;
    font-size: 14px;
    line-height: 20px;
    border: 1px solid #c1c1c1;
  }
  .mailTable tr td.column {
    width: 179px;
    color: #ffffff;
    text-align: right;
  }
  .mailTable tr th {
    padding-right: 7px;
    font-size: 14px;
    text-align: right !important;
  }
}
</style>
